package com.moyuaninfo.myyserver.utils;

import cn.hutool.core.thread.ThreadUtil;
import com.moyuaninfo.myyserver.queue.OperateQueue;
import com.moyuaninfo.myyserver.vo.HikPtzControlOtherVo;
import org.springframework.stereotype.Component;

/**
 * @author 邱祥霸
 * @date 2020/4/29
 */
@Component
public class QueueUtils {
    {
        OperateQueue operateQueue = new OperateQueue();
        ThreadUtil.execute(operateQueue);
    }

    /**
     * 添加任务
     *
     * @param vo: hik
     * @param time: 时间；单位：毫秒
     *
     * @author 邱祥霸
     * @date 2020/4/29
     */
    public void put(HikPtzControlOtherVo vo, long time) {
        OperateQueue.OperateMessage operateMessage = new OperateQueue.OperateMessage(System.currentTimeMillis() + time, vo);
        OperateQueue.deque.put(operateMessage);
    }

    private QueueUtils() {}
}
